package base;

import java.awt.geom.Line2D;
import java.awt.geom.Point2D;


public class ShipSilhouette {
	//private Point2D.Double [] corners;
	//private double[] cornerAngles;
	private Point2D.Double beginCorner, endCorner;
	//private double beginAngle, endAngle;
	public Arc fromTurret;
	private double[] distSquared;
	
	private Ship ship;
	
	//private int beginIndex=-1, endIndex=-1;
	
	public ShipSilhouette(Ship ship, Arc arc, Point2D.Double beginCorner, Point2D.Double endCorner, double[] distSquared /*, double beginAngle, double endAngle*/)
	{
		this.ship = ship;
		this.fromTurret = arc;
		this.distSquared = distSquared;
		/*this.beginAngle = beginAngle;
		this.endAngle = endAngle;*/
		this.beginCorner = beginCorner;
		this.endCorner = endCorner;
	}
	
	public double getMinDistanceSq()
	{
		int minIndex = 0;
		for (int i = 1; i < 4; i++) {
			if (distSquared[i] < distSquared[minIndex]) {
				minIndex = i;
			}
		}
		return distSquared[minIndex];
				
	}
	
	// TODO: pitäisikö olla managed-ref?
	public Ship getShip()
	{
		return ship;
	}

	public Point2D.Double getBeginCorner() {
		return beginCorner;
	}
	
	public Point2D.Double getEndCorner() {
		return endCorner;
	}
	
	public Line2D.Double getSilhLine()
	{
		return new Line2D.Double(beginCorner, endCorner);
	}
/*	
	public double getBeginAngle() {
		return beginAngle;
	}
	
	public double getEndAngle() {
		return cornerAngles[endIndex];
	}
*/
	
}
